#include <stdio.h>

void quick(int* array, int start, int end);

void quickSort(int* array, int length)
{
    quick(array, 0, length);
}

void quick(int* array, int start, int end)
{
    int i, j;
    int temp;
    if(start < end) {
	i = start;
	j = end + 1;
	while(1) {
	    do {
		i++;
	    } while(array[i] > array[start] && i != end);
	    do {
		j--;
	    } while(array[j] < array[start] && j != start);
	    if(i < j) {
		temp = array[i];
		array[i] = array[j];
		array[j] = temp;
	    }
	    else
		break;
	}
	temp = array[start];
	array[start] = array[j];
	array[j] = temp;

	quick(array, start, j - 1);
	quick(array, j + 1, end);
    }
}
